Methods for performing fast detail-preserving image filtering

ABSTRACT

A method for performing fast detail-preserving filtering of an input digital image includes, for each pixel in the image, calculating the difference between the selected pixel and each of its four neighboring pixels located above, left, right, and below the selected pixel, calculating a scaled weighted sum of differences between the actual pixel and its four neighbors, where for each neighboring pixel the weight is an edge-sensing function having a data-adaptive scaling parameter function, and adding the weighted sum of differences to the value of the selected pixel.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims the benefit of U.S. Provisional Patent Application Ser. No. 61/446,274, filed Feb. 24, 2011.

BACKGROUND

1. Field of the Invention

The present invention relates to image processing. More particularly, the present invention relates to image filtering and specifically to fast detail-preserving image filtering.

2. The Prior Art

A digital image with R rows and S columns can be seen as a two-dimensional array of pixels x_((r,s)), where r=1, 2, . . . , R and s=1, 2, . . . , S denote the row and column coordinates, respectively. The input image can be processed by the traditional anisotropic diffusion filter as follows:

$\begin{matrix} {x_{({r,s})}^{\lbrack{i + 1}\rbrack} = {x_{({r,s})}^{\lbrack i\rbrack} + {\lambda{\sum\limits_{{({g,h})} \in \zeta}\;\left\lbrack {{f\left( {x_{({r,s})}^{\lbrack i\rbrack},x_{({g,h})}^{\lbrack i\rbrack}} \right)} \cdot \left( {x_{({r,s})}^{\lbrack i\rbrack} - x_{({g,h})}^{\lbrack i\rbrack}} \right)} \right\rbrack}}}} & (1) \end{matrix}$ where i denotes the iteration index, with i=0 indicating the input (unprocessed) image. The term ζ={(r−1,s), (r,s−1), (r,s+1), (r+1,s)} denotes the neighboring pixels located above, left, right, and below with respect to the pixel location (r,s) under consideration. The term ƒ(·) denotes the edge-sensing function which can be defined as follows:

$\begin{matrix} {{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/\kappa^{2}}}} & (2) \end{matrix}$ where κ is a predetermined parameter, for example, set as κ=2.

The filtering procedure first selects the actual pixel x_((r,s)) to be filtered. Then, the four neighbors for x_((g,h)), for (g,h)εζ and ζ={(r−1,s),(r,s−1), (r,s+1), (r+1,s)}, located above, left, right, and below with respect to the pixel location (r,s) under consideration are selected. Note that the pixel location above, left to, right to and below the actual location (r,s) are indicated as (r−1,s), (r,s−1), (r,s+1), and (r+1,s), respectively. Then, the difference between x_((r,s)) and each of its four neighbors is calculated; these four differences are indicated as x_((r,s)) ^([i])−x_((g,h)) ^([i]), for (g,h)εζ. Each of these four differences is associated with the weight ƒ(x_((r,s)) ^([i]), x_((g,h)) ^([i])) calculated using Equation (2). Once the differences and weights are obtained, the actual pixel x_((r,s)) is adjusted by adding to its value the value of λ·Σ[ƒ(x_((r,s)) ^([i]),x_((g,h)) ^([i]))·(x_((r,s)) ^([i])−x_((g,h)) ^([i]))] which represents the weighted sum of differences between the actual pixel and its four neighbors, the sum is scaled by the parameter, λ which controls the level of this adjustment.

The filtering process then moves to next pixel location and executes the above procedure. The procedure is repeated in all pixel locations of the input image until all pixels are processed. This gives one iteration, which is indicated in Equation (1) using index [i+1] where [i] refers to the input image (for i=0) or the image obtained in previous iteration (for i>0).

Anisotropic diffusion is an iterative filtering process; reasonable quality of the filtered image is usually achieved after a number of iterations, which may not be suitable for real-time processing. This iterative processing requires performing Equation (1) in each pixel location of the input image to produce an image to be used as the input in the subsequent iteration.

BRIEF DESCRIPTION

A method for performing fast detail-preserving filtering of an input digital image includes, for each pixel in the image, calculating the difference between the selected pixel a and each of its four neighboring pixels located above, left, right, and below the selected pixel, calculating a scaled weighted sum of differences between the actual pixel and its four neighbors, where for each neighboring pixel b the weight is an edge-sensing function having a data-adaptive scaling parameter function, and adding the weighted sum of differences to the value of the selected pixel a.

According to one aspect of the present invention, the weight may be

${{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/{\kappa\left( {a,b} \right)}^{2}}}};$ and κ(·) is the data-adaptive scaling function.

According to another aspect of the invention, κ(·) may be a function using the pixel under consideration to estimate noise variance. In one illustrative embodiment, κ(a,b)=θ(Θ₀+Θ₁a+Θ₂a²) where Θ₀, Θ₁, and Θ₂ are predetermined parameters.

According to a further aspect of the invention, κ(·) may be a function using the neighboring pixels to estimate noise variance. In one illustrative embodiment, κ(a,b)=θ(Θ₀+Θ₁b+Θ₂b²).

According to a yet another aspect of the invention, κ(·) may be a function using a combination of the pixel under consideration and the neighboring pixels to estimate noise variance. In one illustrative embodiment, κ(a,b)=θ(Θ₀+Θ₁c+Θ₂c²), wherein the term c=(w_(a)a+w_(b)b)/(w_(a)+w_(b)) and wherein w_(a) and w_(b) are predetermined weights associated with pixels a and b, respectively.

BRIEF DESCRIPTION OF THE DRAWING FIGURES

FIG. 1 is a flow diagram showing an illustrative method for performing fast detail-preserving filtering of an input digital image according to one aspect of the present invention.

FIG. 2 is a flow diagram showing an illustrative method for performing fast detail-preserving filtering of an input digital image according to another aspect of the present invention.

FIG. 3 is a flow diagram showing an illustrative method for performing fast detail-preserving filtering of an input digital image according to another aspect of the present invention.

FIG. 4 is a flow diagram showing an illustrative method for performing fast detail-preserving filtering of an input color digital image according to another aspect of the present invention.

DETAILED DESCRIPTION

Persons of ordinary skill in the art will realize that the following description of the present invention is illustrative only and not in any way limiting. Other embodiments of the invention will readily suggest themselves to such skilled persons.

To speed-up the filtering process while achieving similar noise smoothing performance as the above prior solution, the proposed solution uses the edge-sensing function ƒ(·) with a data-adaptive scaling function κ(·), as follows:

$\begin{matrix} {{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/{\kappa\left( {a,b} \right)}^{2}}}} & (3) \end{matrix}$ Following the notation used in Equation (1), the terms a and b denote the actual pixel and its neighbor, respectively.

Since anisotropic diffusion is typically used in denoising applications, it is reasonable that κ(·) reflects characteristics of noise present in the image. One possible solution is to estimate the noise level from the image and then reflect this estimate in the design of κ(·). However, this approach may be too slow and complex, and may be accompanied with an estimation error that can lead to insufficient noise suppression when the noise level is underestimated or excessive smoothing when the noise level is overestimated. Therefore, a more practical solution, at least when it comes to imaging devices and systems with known noise characteristics, is to evaluate image noise during sensor calibration and them characterize this noise using the corresponding mathematical model.

For example, in practice, noise variance can be characterized using the quadratic model with parameters Θ₀, Θ₁, and Θ₂ as follows: κ(a,b)=θ(Θ₀+Θ₁ a+Θ ₂ a ²)  (4) where θ is a scaling factor that can be used to control the amount of denoising. Namely, stronger smoothing effects can be obtained by increasing the value of θ whereas better preservation of image details can be obtained by decreasing the value of θ. In general, parameter θ can be predetermined, or controlled by the user, or even calculated adaptively using the statistics of the image under consideration. Example values of quadratic model parameters obtained in calibration can be set as Θ₀=2.140387, Θ₁=0.027064, and Θ₂=0.000017. Scaling parameter θ can usually range from 0.1 to 10. Specific values of these design parameters may vary depending on the image sensor characteristics, image quality requirements, application constraints, etc.

Referring now to FIG. 1, a flow diagram shows an illustrative method for performing fast detail-preserving filtering of an input digital image according to one aspect of the present invention wherein the scaling factor is a function of the selected pixel. The process begins at reference numeral 10. At reference numeral 12, a pixel in the image is selected for processing. At reference numeral 14, the differences between the selected pixel and its neighbors above, below, to the right, and to the left are calculated.

At reference numeral 16, a weighted and scaled sum of the differences between the selected pixel and its four neighbors is calculated, with the scaling function κ(·) being a function of the selected pixel. At reference numeral 18, the weighted and scaled sum of the differences is added to the selected pixel.

At reference numeral 20, it is determined whether the selected pixel was the last unprocessed pixel in the digital image. If so, the process ends at reference numeral 22. If the selected pixel was the not last unprocessed pixel in the digital image, the process returns to reference numeral 12, where another pixel in the image is selected for processing. If more than one iteration is to be performed, then the filtered image produced at reference numeral 22 is used in the subsequent iteration as the input image at reference numeral 10 and the whole filtering procedure (reference numerals 12 to 20) is repeated again.

Equation (4) shows an example of the scaling function κ(·) that uses the pixel under consideration to estimate the noise variance. Since this sample is shared for all (g,h)εζ, Equation (4) needs to be calculated only once per pixel location (r,s) denoised by Equation (1). Alternative solutions can use the neighboring pixels instead, resulting in κ(a,b)=θ(Θ₀+Θ₁ b+Θ ₂ b ²)  (5) or the combination of the actual pixel a and its neighbor b as follows: Θ(a,b)=θ(Θ₀+Θ₁ c+Θ ₂ c ²), with c=(w _(a) a+w _(b) b)/(w _(a) +w _(b))  (6) where w_(a) and w_(b) are the weights associated with pixels a and b, respectively. Note that this invention is not limited to the above examples, as it can work with some other forms of the scaling function κ(·).

Referring now to FIG. 2, a flow diagram shows an illustrative method for performing fast detail-preserving filtering of an input digital image according to another aspect of the present invention wherein the scaling factor is a function of the neighboring pixels. The process begins at reference numeral 30. At reference numeral 32, a pixel in the image is selected for processing. At reference numeral 34, the differences between the selected pixel and its neighbors above, below, to the right, and to the left are calculated.

At reference numeral 36, a weighted and scaled sum of the differences between the selected pixel and its four neighbors is calculated, with the scaling function κ(·) being a function of the neighboring pixels. At reference numeral 38, the weighted and scaled sum of the differences is added to the selected pixel.

At reference numeral 40, it is determined whether the selected pixel was the last unprocessed pixel in the digital image. If so, the process ends at reference numeral 42. If the selected pixel was the not last unprocessed pixel in the digital image, the process returns to reference numeral 32, where another pixel in the image is selected for processing. If more than one iteration is to be performed, then the filtered image produced at reference numeral 42 is used in the subsequent iteration as the input image at reference numeral 30 and the whole filtering procedure (reference numerals 32 to 40) is repeated again.

Referring now to FIG. 3, a flow diagram shows an illustrative method for performing fast detail-preserving filtering of an input digital image according to another aspect of the present invention wherein the scaling factor is a function of the selected pixel and its neighbors. The process begins at reference numeral 50. At reference numeral 52, a pixel in the image is selected for processing. At reference numeral 54, the differences between the selected pixel and its neighbors above, below, to the right, and to the left are calculated.

At reference numeral 56, a weighted and scaled sum of the differences between the selected pixel and its four neighboring pixels is calculated, with the scaling function κ(·) being a function of the selected pixel and its neighbors. At reference numeral 58, the weighted and scaled sum of the differences is added to the selected pixel.

At reference numeral 60, it is determined whether the selected pixel was the last unprocessed pixel in the digital image. If so, the process ends at reference numeral 62. If the selected pixel was the not last unprocessed pixel in the digital image, the process returns to reference numeral 52, where another pixel in the image is selected for processing. If more than one iteration is to be performed, then the filtered image produced at reference numeral 62 is used in the subsequent iteration as the input image at reference numeral 50 and the whole filtering procedure (reference numerals 52 to 60) is repeated again.

In case of color images, a straightforward extension of the method of the present invention is to apply the method of the present invention to each color channel separately. Advanced solutions, with the focus on preserving the color correlation, should use a vector form of Equation (3). In one example, (a−b)²/κ(a,b)² in Equation (3) can be replaced by the sum or average value of (a−b)²/κ(a,b)² values obtained for each color channel. In another example, (a−b)² can be replaced with a distance or similarity measure, such as the Euclidean distance or the Minkowski metric, for quantifying the difference between two color vectors. The value obtained using this distance measure should be scaled by the sum or average value of κ(a,b)² obtained for each color channel. These advanced solutions ensure consistent processing across color channels due to using consistent weights for each color component at the pixel location being filtered.

Referring now to FIG. 4, a flow diagram shows an illustrative method for performing fast detail-preserving filtering of an input digital image according to one aspect of the present invention wherein the scaling factor is a function of the selected pixel. The process begins at reference numeral 70. At reference numeral 72, a pixel in the image is selected for processing. At reference numeral 74, the differences between the selected pixel and its neighbors above, below, to the right, and to the left are calculated.

At reference numeral 76, a weighted and scaled sum of the differences between the selected pixel and its four neighbors is calculated, with the scaling function κ(·) being a function of the selected pixel. At reference numeral 78, the weighted and scaled sum of the differences is added to the selected pixel.

At reference numeral 80, it is determined whether the selected pixel was the last unprocessed pixel in the digital image. If so, the process ends at reference numeral 82. If the selected pixel was the not last unprocessed pixel in the digital image, the process returns to reference numeral 72, where another pixel in the image is selected for processing. If more than one iteration is to be performed, then the filtered image produced at reference numeral 82 is used in the subsequent iteration as the input image at reference numeral 70 and the whole filtering procedure (reference numerals 72 to 80) is repeated again.

While embodiments and applications of this invention have been shown and described, it would be apparent to those skilled in the art that many more modifications than mentioned above are possible without departing from the inventive concepts herein. The invention, therefore, is not to be restricted except in the spirit of the appended claims. 

What is claimed is:
 1. A method for creating an output digital image by performing fast detail-preserving filtering of an input digital image comprising: a) selecting a pixel a from the input digital image, pixel a not being in a row or column at the boundary of the image; b) calculating the difference between the selected pixel and each of its four neighboring pixels located above, left, right, and below the selected pixel; c) calculating a scaled weighted sum of differences between the selected pixel and its four neighbors, the difference being scaled by a data-adaptive scaling function using the pixel under consideration to estimate noise variance, where for each neighboring pixel b the weight is a function ƒ of the difference between the selected pixel a and its neighboring pixel b under consideration, where ${{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/{\kappa\left( {a,b} \right)}^{2}}}},$ the data-adaptive scaling function being κ(a,b)=θ(Θ₀+Θ₁a+Θ₂a²) where θ is a scaling factor, and where Θ₀, Θ₁, and Θ₂ are quadratic model parameters; d) adding the weighted sum of differences to the value of the selected pixel; and performing a) through d) for each pixel in the input digital image that is not in a row or column at the boundary of the image.
 2. A method for creating an output digital image by performing fast detail-preserving filtering of an input digital image comprising: a) selecting a pixel a from the input digital image, pixel a not being in a row or column at the boundary of the image; b) calculating the difference between the selected pixel and each of its four neighboring pixels located above, left, right, and below the selected pixel; c) calculating a scaled weighted sum of differences between the selected pixel and its four neighbors, the difference being scaled by a data-adaptive scaling function using the neighboring pixels to estimate noise variance, where for each neighboring pixel b the weight is a function ƒ of the difference between the selected pixel a and its neighboring pixel b under consideration, where ${{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/{\kappa\left( {a,b} \right)}^{2}}}},$ the data-adaptive scaling function being κ(a,b)=θ(Θ₀+Θ₁b+Θ₂b²) where θ is a scaling factor, and where Θ₀, Θ₁, and Θ₂ are quadratic model parameters; d) adding the weighted sum of differences to the value of the selected pixel; and performing a) through d) for each pixel in the input digital image that is not in a row or column at the boundary of the image.
 3. A method for creatin an output digital image by performing fast detail-preserving filtering of an input digital image comprising: a) selecting a pixel a from the input digital image, pixel a not being in a row or column at the boundary of the image; b) calculating the difference between the selected pixel and each of its four neighboring pixels located above, left, right, and below the selected pixel; c) calculating a scaled weighted sum of differences between the selected pixel and its four neighbors, the difference being scaled by a data-adaptive scaling function using a combination of the pixel under consideration and the neighboring pixels to estimate noise variance, where for each neighboring pixel b the weight is a function ƒ of the difference between the selected pixel a and its neighboring pixel b under consideration, where ${{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/{\kappa\left( {a,b} \right)}^{2}}}},$ the data-adaptive scaling function being κ(a,b)=θ(Θ₀+Θ₁c+Θ₂c²) where θ is a scaling factor, and where Θ₀, Θ₁, and Θ₂ are quadratic model parameters, and the term c=(w_(a)a+w_(b)b)/(w_(a)+w_(b)), and where w_(a) and w_(b) are weights associated with pixels a and b, respectively; d) adding the weighted sum of differences to the value of the selected pixel; and performing a) through d) for each pixel in the input digital image that is not in a row or column at the boundary of the image.
 4. A method for creating an output color digital image by performing fast detail-preserving filtering of an input color digital image comprising: a) selecting a pixel a from the input color digital image, pixel a not being in a row or column at the boundary of the image; b) calculating separately for each color channel in the selected pixel the difference between the selected pixel and each of its four neighboring pixels located above, left, right, and below the selected pixel; c) calculating separately for each color channel in the selected pixel a scaled weighted sum of differences between the selected pixel and its four neighbors, the difference being scaled by a data-adaptive scaling function using the pixel under consideration to estimate noise variance, where for each neighboring pixel b the weight is a function ƒ of the difference between the selected pixel a and its neighboring pixel b under consideration, where ${{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/{\kappa\left( {a,b} \right)}^{2}}}},$ the data-adaptive scaling function being κ(a,b)=θ(Θ₀+Θ₁a+Θ₂a²) where θ is a scaling factor, and where Θ₀, Θ₁, and Θ₂ are quadratic model parameters; d) adding separately for each color channel in the selected pixel the weighted sum of differences to the value of the selected pixel; and performing a) through d) for each pixel in the input color digital image that is not in a row or column at the boundary of the image.
 5. A method for creating an output color digital image by performing fast detail-preserving filtering of an input color digital image comprising: a) selecting a pixel a from the input color digital image, pixel a not being in a row or column at the boundary of the image; b) calculating separately for each color channel in the selected pixel the difference between the selected pixel and each of its four neighboring pixels located above, left, right, and below the selected pixel; c) calculating separately for each color channel in the selected pixel a scaled weighted sum of differences between the selected pixel and its four neighbors, the difference being scaled b a data-adaptive scaling function using the pixel under consideration to estimate noise variance, where for each neighboring pixel b the weight is a function ƒ of the difference between the selected pixel a and its neighboring pixel b under consideration, where ${{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/{\kappa\left( {a,b} \right)}^{2}}}},$ the data-adaptive scaling function being κ(a,b)=θ(Θ₀+Θ₁b+Θ₂b²) where θ is a scaling factor, and where Θ₀, Θ₁, and Θ₂ are quadratic model parameters; d) adding separately for each color channel in the selected pixel the weighted sum of differences to the value of the selected pixel; and performing a) through d) for each pixel in the input color digital image that is not in a row or column at the boundary of the image.
 6. A method for creating an output color digital image by performing fast detail-preserving filtering of an input color digital image comprising: a) selecting a pixel a from the input color digital image, pixel a not being in a row or column at the boundary of the image; b) calculating separately for each color channel in the selected pixel the difference between the selected pixel and each of its four neighboring pixels located above, left, right, and below the selected pixel; c) calculating separately for each color channel in the selected pixel a scaled weighted sum of differences between the selected pixel and its four neighbors, the difference being scaled by a data-adaptive scaling function using a combination of the pixel under consideration and the neighboring pixels to estimate noise variance, where for each neighboring pixel b the weight function ƒ of the difference between the selected pixel a and its neighboring pixel b under consideration, where ${{f\left( {a,b} \right)} = \frac{1}{1 + {\left( {a - b} \right)^{2}/{\kappa\left( {a,b} \right)}^{2}}}},$ the data-adaptive scaling function being κ(a,b)=θ(Θ₀+Θ₁c+Θ₂c²) where θ is a scaling factor, and where Θ₀, Θ₁, and Θ₂ are quadratic model parameters, and the term c=(w_(a)a+w_(b)b)/(w_(a)+w_(b)), where w_(a) and w_(b) are weights associated with pixels a and b, respectively; d) adding separately for each color channel in the selected pixel the weighted sum of differences to the value of the selected pixel; and performing a) through d) for each pixel in the input color digital image that is not in a row or column at the boundary of the image. 